﻿@model MSAcademic.v2.Web.Models.Home.ContentSectionViewModel
@{
    var title = "";
    if (Model.ContentSectionId == 1)
    { title = "Novosti";  }
    else if (Model.ContentSectionId == 2)
    { title = "Članci";  }
    else
    { title = "Tutoriali";  }

    ViewBag.Title = title;
}

<div class="consec">
    <h1>
        @if (Model.ContentSectionId == 1)
        { <span>Novosti</span> }
        else if (Model.ContentSectionId == 2)
        { <span>Članci</span> }
        else
        { <span>Tutoriali</span> }
    </h1>

    <div class="articles">
        @if (Model.SubSectionsWithTheirArticles.Count > 0)
        {
            foreach (var subsection in Model.SubSectionsWithTheirArticles)
            {
            <div class="clearfix">
                <h2>@subsection.Item1.Name </h2>
                @foreach (var article in subsection.Item2.Take(16))
                {
                    <div class="item">
                        <div class="picture">
                            <a href="@Url.RouteUrl("ArticleProfile", new { articleId = article.Item1.Id })"> 
                                <img src="@article.Item1.PictureUrlNormal" alt="@article.Item1.Title" />
                            </a>
                        </div>
                        <div class="data">
                            <a href="@Url.RouteUrl("ArticleProfile", new { articleId = article.Item1.Id })">
                                <h3>@Html.Raw(article.Item1.Title)</h3>
                            </a>

                            <div class="meta">
                                <a href="@Url.RouteUrl("ViewAuthorProfile", new { authorId = article.Item2.Id })">@article.Item2.FirstName @article.Item2.LastName</a> -
                                @article.Item1.PublishedOn.Value.ToString("dd.MM.yyyy. u HH:mm")
                            </div>
                        </div>
                    </div>
                }
            </div>
            }
        }
    </div>
</div>
